<template>
	<view>
		<view>
			<u-tabs-swiper  :list="types" @change="change()" :gutter="100" :current="current"></u-tabs-swiper>
			<pageInfo :pageInfos="pageInfos"></pageInfo>
		</view>
	</view>
</template>

<script>
	import pageInfo from '../../views/pageinfo.vue'
	export default {
		components:{
			pageInfo
		},
		data() {
			return {
				pageInfos: [],
				types: [],
				current: 0
			}
		},
		methods: {
			change(index){
				this.getPageInfo(index);
				this.current = index;
			},
			getPageInfo(index){
				this.$u.get("https://apiblog.hwawy.cn/api/type/listBlog?currentPage=1&pageSize=10",{sId:this.types[index].id}).then( res => {
					this.pageInfos = res.records;
				})
			}
		},
		onLoad() {
			this.$u.get("https://apiblog.hwawy.cn/api/listType").then(res => {
				this.types = res;
				for (let i = 0; i < res.length; i++) {
					this.types[i].count = 10;
				}
				this.getPageInfo(0);
			})
		}
		
	}
</script>

<style>

</style>
